.class public Lorg/apache/tika/parser/mp3/Mp3Parser;
.super Lorg/apache/tika/parser/AbstractParser;
.source "Mp3Parser.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lorg/apache/tika/parser/mp3/Mp3Parser$ID3TagsAndAudio;
    }
.end annotation


# static fields
.field public static final ALBUM:Ljava/lang/String; = "xmpDM:album"

.field public static final ARTIST:Ljava/lang/String; = "artist"

.field public static final TITLE:Ljava/lang/String; = "title"

.field private static final serialVersionUID:J = 0x7679c8693a6d3bd2L


# direct methods
.method public constructor <init>()V
    .locals 0

    .line 1
    invoke-direct {p0}, Lorg/apache/tika/parser/AbstractParser;-><init>()V

    return-void
.end method

.method protected static getAllTagHandlers(Ljava/io/InputStream;)Lorg/apache/tika/parser/mp3/Mp3Parser$ID3TagsAndAudio;
    .locals 7
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;,
            Lorg/xml/sax/SAXException;,
            Lorg/apache/tika/exception/TikaException;
        }
    .end annotation

    const/4 v0, 0x0

    move-object v1, v0

    move-object v2, v1

    move-object v3, v2

    .line 1
    :cond_0
    :goto_0
    invoke-static {p0}, Lorg/apache/tika/parser/mp3/ID3v2Frame;->createFrameIfPresent(Ljava/io/InputStream;)Lorg/apache/tika/parser/mp3/MP3Frame;

    move-result-object v4

    if-eqz v4, :cond_4

    if-nez v0, :cond_4

    .line 2
    instance-of v5, v4, Lorg/apache/tika/parser/mp3/ID3v2Frame;

    if-eqz v5, :cond_3

    .line 3
    check-cast v4, Lorg/apache/tika/parser/mp3/ID3v2Frame;

    .line 4
    invoke-virtual {v4}, Lorg/apache/tika/parser/mp3/ID3v2Frame;->getMajorVersion()I

    move-result v5

    const/4 v6, 0x4

    if-ne v5, v6, :cond_1

    .line 5
    new-instance v1, Lorg/apache/tika/parser/mp3/ID3v24Handler;

    invoke-direct {v1, v4}, Lorg/apache/tika/parser/mp3/ID3v24Handler;-><init>(Lorg/apache/tika/parser/mp3/ID3v2Frame;)V

    goto :goto_0

    .line 6
    :cond_1
    invoke-virtual {v4}, Lorg/apache/tika/parser/mp3/ID3v2Frame;->getMajorVersion()I

    move-result v5

    const/4 v6, 0x3

    if-ne v5, v6, :cond_2

    .line 7
    new-instance v2, Lorg/apache/tika/parser/mp3/ID3v23Handler;

    invoke-direct {v2, v4}, Lorg/apache/tika/parser/mp3/ID3v23Handler;-><init>(Lorg/apache/tika/parser/mp3/ID3v2Frame;)V

    goto :goto_0

    .line 8
    :cond_2
    invoke-virtual {v4}, Lorg/apache/tika/parser/mp3/ID3v2Frame;->getMajorVersion()I

    move-result v5

    const/4 v6, 0x2

    if-ne v5, v6, :cond_0

    .line 9
    new-instance v3, Lorg/apache/tika/parser/mp3/ID3v22Handler;

    invoke-direct {v3, v4}, Lorg/apache/tika/parser/mp3/ID3v22Handler;-><init>(Lorg/apache/tika/parser/mp3/ID3v2Frame;)V

    goto :goto_0

    .line 10
    :cond_3
    instance-of v5, v4, Lorg/apache/tika/parser/mp3/AudioFrame;

    if-eqz v5, :cond_0

    .line 11
    move-object v0, v4

    check-cast v0, Lorg/apache/tika/parser/mp3/AudioFrame;

    goto :goto_0

    .line 12
    :cond_4
    new-instance v4, Lorg/apache/tika/parser/mp3/LyricsHandler;

    invoke-direct {v4, p0}, Lorg/apache/tika/parser/mp3/LyricsHandler;-><init>(Ljava/io/InputStream;)V

    .line 13
    iget-object p0, v4, Lorg/apache/tika/parser/mp3/LyricsHandler;->id3v1:Lorg/apache/tika/parser/mp3/ID3v1Handler;

    .line 14
    new-instance v5, Ljava/util/ArrayList;

    invoke-direct {v5}, Ljava/util/ArrayList;-><init>()V

    if-eqz v1, :cond_5

    .line 15
    invoke-virtual {v1}, Lorg/apache/tika/parser/mp3/ID3v24Handler;->getTagsPresent()Z

    move-result v6

    if-eqz v6, :cond_5

    .line 16
    invoke-interface {v5, v1}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    :cond_5
    if-eqz v2, :cond_6

    .line 17
    invoke-virtual {v2}, Lorg/apache/tika/parser/mp3/ID3v23Handler;->getTagsPresent()Z

    move-result v1

    if-eqz v1, :cond_6

    .line 18
    invoke-interface {v5, v2}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    :cond_6
    if-eqz v3, :cond_7

    .line 19
    invoke-virtual {v3}, Lorg/apache/tika/parser/mp3/ID3v22Handler;->getTagsPresent()Z

    move-result v1

    if-eqz v1, :cond_7

    .line 20
    invoke-interface {v5, v3}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    :cond_7
    if-eqz p0, :cond_8

    .line 21
    invoke-virtual {p0}, Lorg/apache/tika/parser/mp3/ID3v1Handler;->getTagsPresent()Z

    move-result v1

    if-eqz v1, :cond_8

    .line 22
    invoke-interface {v5, p0}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    .line 23
    :cond_8
    new-instance p0, Lorg/apache/tika/parser/mp3/Mp3Parser$ID3TagsAndAudio;

    invoke-direct {p0}, Lorg/apache/tika/parser/mp3/Mp3Parser$ID3TagsAndAudio;-><init>()V

    .line 24
    invoke-static {p0, v0}, Lorg/apache/tika/parser/mp3/Mp3Parser$ID3TagsAndAudio;->access$102(Lorg/apache/tika/parser/mp3/Mp3Parser$ID3TagsAndAudio;Lorg/apache/tika/parser/mp3/AudioFrame;)Lorg/apache/tika/parser/mp3/AudioFrame;

    .line 25
    invoke-static {p0, v4}, Lorg/apache/tika/parser/mp3/Mp3Parser$ID3TagsAndAudio;->access$202(Lorg/apache/tika/parser/mp3/Mp3Parser$ID3TagsAndAudio;Lorg/apache/tika/parser/mp3/LyricsHandler;)Lorg/apache/tika/parser/mp3/LyricsHandler;

    .line 26
    invoke-interface {v5}, Ljava/util/List;->size()I

    move-result v0

    new-array v0, v0, [Lorg/apache/tika/parser/mp3/ID3Tags;

    invoke-interface {v5, v0}, Ljava/util/List;->toArray([Ljava/lang/Object;)[Ljava/lang/Object;

    move-result-object v0

    check-cast v0, [Lorg/apache/tika/parser/mp3/ID3Tags;

    invoke-static {p0, v0}, Lorg/apache/tika/parser/mp3/Mp3Parser$ID3TagsAndAudio;->access$002(Lorg/apache/tika/parser/mp3/Mp3Parser$ID3TagsAndAudio;[Lorg/apache/tika/parser/mp3/ID3Tags;)[Lorg/apache/tika/parser/mp3/ID3Tags;

    return-object p0
.end method


# virtual methods
.method public parse(Ljava/io/InputStream;Lorg/apache/tika/metadata/Metadata;)V
    .locals 6
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;,
            Lorg/xml/sax/SAXException;,
            Lorg/apache/tika/exception/TikaException;
        }
    .end annotation

    .line 1
    sget-object v0, Lorg/apache/tika/metadata/Metadata;->CONTENT_TYPE:Ljava/lang/String;

    const-string v1, "audio/mpeg"

    invoke-virtual {p2, v0, v1}, Lorg/apache/tika/metadata/Metadata;->set(Ljava/lang/String;Ljava/lang/String;)V

    const-string v0, "xmpDM:audioCompressor"

    const-string v1, "MP3"

    .line 2
    invoke-virtual {p2, v0, v1}, Lorg/apache/tika/metadata/Metadata;->set(Ljava/lang/String;Ljava/lang/String;)V

    .line 3
    invoke-static {p1}, Lorg/apache/tika/parser/mp3/Mp3Parser;->getAllTagHandlers(Ljava/io/InputStream;)Lorg/apache/tika/parser/mp3/Mp3Parser$ID3TagsAndAudio;

    move-result-object p1

    .line 4
    invoke-static {p1}, Lorg/apache/tika/parser/mp3/Mp3Parser$ID3TagsAndAudio;->access$000(Lorg/apache/tika/parser/mp3/Mp3Parser$ID3TagsAndAudio;)[Lorg/apache/tika/parser/mp3/ID3Tags;

    move-result-object v0

    array-length v0, v0

    if-lez v0, :cond_4

    .line 5
    new-instance v0, Lorg/apache/tika/parser/mp3/CompositeTagHandler;

    invoke-static {p1}, Lorg/apache/tika/parser/mp3/Mp3Parser$ID3TagsAndAudio;->access$000(Lorg/apache/tika/parser/mp3/Mp3Parser$ID3TagsAndAudio;)[Lorg/apache/tika/parser/mp3/ID3Tags;

    move-result-object v1

    invoke-direct {v0, v1}, Lorg/apache/tika/parser/mp3/CompositeTagHandler;-><init>([Lorg/apache/tika/parser/mp3/ID3Tags;)V

    .line 6
    invoke-virtual {v0}, Lorg/apache/tika/parser/mp3/CompositeTagHandler;->getTitle()Ljava/lang/String;

    move-result-object v1

    const-string v2, "title"

    invoke-virtual {p2, v2, v1}, Lorg/apache/tika/metadata/Metadata;->set(Ljava/lang/String;Ljava/lang/String;)V

    .line 7
    invoke-virtual {v0}, Lorg/apache/tika/parser/mp3/CompositeTagHandler;->getArtist()Ljava/lang/String;

    move-result-object v1

    const-string v2, "artist"

    invoke-virtual {p2, v2, v1}, Lorg/apache/tika/metadata/Metadata;->set(Ljava/lang/String;Ljava/lang/String;)V

    .line 8
    invoke-virtual {v0}, Lorg/apache/tika/parser/mp3/CompositeTagHandler;->getArtist()Ljava/lang/String;

    move-result-object v1

    const-string v2, "xmpDM:artist"

    invoke-virtual {p2, v2, v1}, Lorg/apache/tika/metadata/Metadata;->set(Ljava/lang/String;Ljava/lang/String;)V

    .line 9
    invoke-virtual {v0}, Lorg/apache/tika/parser/mp3/CompositeTagHandler;->getComposer()Ljava/lang/String;

    move-result-object v1

    const-string v2, "xmpDM:composer"

    invoke-virtual {p2, v2, v1}, Lorg/apache/tika/metadata/Metadata;->set(Ljava/lang/String;Ljava/lang/String;)V

    .line 10
    invoke-virtual {v0}, Lorg/apache/tika/parser/mp3/CompositeTagHandler;->getAlbum()Ljava/lang/String;

    move-result-object v1

    const-string v2, "xmpDM:album"

    invoke-virtual {p2, v2, v1}, Lorg/apache/tika/metadata/Metadata;->set(Ljava/lang/String;Ljava/lang/String;)V

    .line 11
    invoke-virtual {v0}, Lorg/apache/tika/parser/mp3/CompositeTagHandler;->getYear()Ljava/lang/String;

    move-result-object v1

    const-string v2, "xmpDM:releaseDate"

    invoke-virtual {p2, v2, v1}, Lorg/apache/tika/metadata/Metadata;->set(Ljava/lang/String;Ljava/lang/String;)V

    .line 12
    invoke-virtual {v0}, Lorg/apache/tika/parser/mp3/CompositeTagHandler;->getGenre()Ljava/lang/String;

    move-result-object v1

    const-string v2, "xmpDM:genre"

    invoke-virtual {p2, v2, v1}, Lorg/apache/tika/metadata/Metadata;->set(Ljava/lang/String;Ljava/lang/String;)V

    .line 13
    new-instance v1, Ljava/util/ArrayList;

    invoke-direct {v1}, Ljava/util/ArrayList;-><init>()V

    .line 14
    invoke-virtual {v0}, Lorg/apache/tika/parser/mp3/CompositeTagHandler;->getComments()Ljava/util/List;

    move-result-object v2

    invoke-interface {v2}, Ljava/util/List;->iterator()Ljava/util/Iterator;

    move-result-object v2

    :goto_0
    invoke-interface {v2}, Ljava/util/Iterator;->hasNext()Z

    move-result v3

    if-eqz v3, :cond_3

    invoke-interface {v2}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v3

    check-cast v3, Lorg/apache/tika/parser/mp3/ID3Tags$ID3Comment;

    .line 15
    new-instance v4, Ljava/lang/StringBuffer;

    invoke-direct {v4}, Ljava/lang/StringBuffer;-><init>()V

    .line 16
    invoke-virtual {v3}, Lorg/apache/tika/parser/mp3/ID3Tags$ID3Comment;->getLanguage()Ljava/lang/String;

    move-result-object v5

    if-eqz v5, :cond_0

    .line 17
    invoke-virtual {v3}, Lorg/apache/tika/parser/mp3/ID3Tags$ID3Comment;->getLanguage()Ljava/lang/String;

    move-result-object v5

    invoke-virtual {v4, v5}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    const-string v5, " - "

    .line 18
    invoke-virtual {v4, v5}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    .line 19
    :cond_0
    invoke-virtual {v3}, Lorg/apache/tika/parser/mp3/ID3Tags$ID3Comment;->getDescription()Ljava/lang/String;

    move-result-object v5

    if-eqz v5, :cond_1

    .line 20
    invoke-virtual {v3}, Lorg/apache/tika/parser/mp3/ID3Tags$ID3Comment;->getDescription()Ljava/lang/String;

    move-result-object v5

    invoke-virtual {v4, v5}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    .line 21
    invoke-virtual {v3}, Lorg/apache/tika/parser/mp3/ID3Tags$ID3Comment;->getText()Ljava/lang/String;

    move-result-object v5

    if-eqz v5, :cond_1

    const-string v5, "\n"

    .line 22
    invoke-virtual {v4, v5}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    .line 23
    :cond_1
    invoke-virtual {v3}, Lorg/apache/tika/parser/mp3/ID3Tags$ID3Comment;->getText()Ljava/lang/String;

    move-result-object v5

    if-eqz v5, :cond_2

    .line 24
    invoke-virtual {v3}, Lorg/apache/tika/parser/mp3/ID3Tags$ID3Comment;->getText()Ljava/lang/String;

    move-result-object v3

    invoke-virtual {v4, v3}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    .line 25
    :cond_2
    invoke-virtual {v4}, Ljava/lang/StringBuffer;->toString()Ljava/lang/String;

    move-result-object v3

    invoke-interface {v1, v3}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    .line 26
    invoke-virtual {v4}, Ljava/lang/StringBuffer;->toString()Ljava/lang/String;

    move-result-object v3

    const-string v4, "xmpDM:logComment"

    invoke-virtual {p2, v4, v3}, Lorg/apache/tika/metadata/Metadata;->add(Ljava/lang/String;Ljava/lang/String;)V

    goto :goto_0

    .line 27
    :cond_3
    invoke-virtual {v0}, Lorg/apache/tika/parser/mp3/CompositeTagHandler;->getTrackNumber()Ljava/lang/String;

    move-result-object v1

    if-eqz v1, :cond_4

    .line 28
    invoke-virtual {v0}, Lorg/apache/tika/parser/mp3/CompositeTagHandler;->getTrackNumber()Ljava/lang/String;

    move-result-object v0

    const-string v1, "xmpDM:trackNumber"

    invoke-virtual {p2, v1, v0}, Lorg/apache/tika/metadata/Metadata;->set(Ljava/lang/String;Ljava/lang/String;)V

    .line 29
    :cond_4
    invoke-static {p1}, Lorg/apache/tika/parser/mp3/Mp3Parser$ID3TagsAndAudio;->access$100(Lorg/apache/tika/parser/mp3/Mp3Parser$ID3TagsAndAudio;)Lorg/apache/tika/parser/mp3/AudioFrame;

    move-result-object v0

    if-eqz v0, :cond_8

    .line 30
    invoke-static {p1}, Lorg/apache/tika/parser/mp3/Mp3Parser$ID3TagsAndAudio;->access$100(Lorg/apache/tika/parser/mp3/Mp3Parser$ID3TagsAndAudio;)Lorg/apache/tika/parser/mp3/AudioFrame;

    move-result-object v0

    invoke-virtual {v0}, Lorg/apache/tika/parser/mp3/AudioFrame;->getSampleRate()I

    move-result v0

    invoke-static {v0}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;

    move-result-object v0

    const-string v1, "samplerate"

    invoke-virtual {p2, v1, v0}, Lorg/apache/tika/metadata/Metadata;->set(Ljava/lang/String;Ljava/lang/String;)V

    .line 31
    invoke-static {p1}, Lorg/apache/tika/parser/mp3/Mp3Parser$ID3TagsAndAudio;->access$100(Lorg/apache/tika/parser/mp3/Mp3Parser$ID3TagsAndAudio;)Lorg/apache/tika/parser/mp3/AudioFrame;

    move-result-object v0

    invoke-virtual {v0}, Lorg/apache/tika/parser/mp3/AudioFrame;->getChannels()I

    move-result v0

    invoke-static {v0}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;

    move-result-object v0

    const-string v1, "channels"

    invoke-virtual {p2, v1, v0}, Lorg/apache/tika/metadata/Metadata;->set(Ljava/lang/String;Ljava/lang/String;)V

    .line 32
    invoke-static {p1}, Lorg/apache/tika/parser/mp3/Mp3Parser$ID3TagsAndAudio;->access$100(Lorg/apache/tika/parser/mp3/Mp3Parser$ID3TagsAndAudio;)Lorg/apache/tika/parser/mp3/AudioFrame;

    move-result-object v0

    invoke-virtual {v0}, Lorg/apache/tika/parser/mp3/AudioFrame;->getVersion()Ljava/lang/String;

    move-result-object v0

    const-string v1, "version"

    invoke-virtual {p2, v1, v0}, Lorg/apache/tika/metadata/Metadata;->set(Ljava/lang/String;Ljava/lang/String;)V

    .line 33
    invoke-static {p1}, Lorg/apache/tika/parser/mp3/Mp3Parser$ID3TagsAndAudio;->access$100(Lorg/apache/tika/parser/mp3/Mp3Parser$ID3TagsAndAudio;)Lorg/apache/tika/parser/mp3/AudioFrame;

    move-result-object v0

    invoke-virtual {v0}, Lorg/apache/tika/parser/mp3/AudioFrame;->getSampleRate()I

    move-result v0

    invoke-static {v0}, Ljava/lang/Integer;->toString(I)Ljava/lang/String;

    move-result-object v0

    const-string v1, "xmpDM:audioSampleRate"

    .line 34
    invoke-virtual {p2, v1, v0}, Lorg/apache/tika/metadata/Metadata;->set(Ljava/lang/String;Ljava/lang/String;)V

    .line 35
    invoke-static {p1}, Lorg/apache/tika/parser/mp3/Mp3Parser$ID3TagsAndAudio;->access$100(Lorg/apache/tika/parser/mp3/Mp3Parser$ID3TagsAndAudio;)Lorg/apache/tika/parser/mp3/AudioFrame;

    move-result-object v0

    invoke-virtual {v0}, Lorg/apache/tika/parser/mp3/AudioFrame;->getChannels()I

    move-result v0

    const/4 v1, 0x1

    const-string v2, "xmpDM:audioChannelType"

    if-ne v0, v1, :cond_5

    const-string p1, "Mono"

    .line 36
    invoke-virtual {p2, v2, p1}, Lorg/apache/tika/metadata/Metadata;->set(Ljava/lang/String;Ljava/lang/String;)V

    goto :goto_1

    .line 37
    :cond_5
    invoke-static {p1}, Lorg/apache/tika/parser/mp3/Mp3Parser$ID3TagsAndAudio;->access$100(Lorg/apache/tika/parser/mp3/Mp3Parser$ID3TagsAndAudio;)Lorg/apache/tika/parser/mp3/AudioFrame;

    move-result-object v0

    invoke-virtual {v0}, Lorg/apache/tika/parser/mp3/AudioFrame;->getChannels()I

    move-result v0

    const/4 v1, 0x2

    if-ne v0, v1, :cond_6

    const-string p1, "Stereo"

    .line 38
    invoke-virtual {p2, v2, p1}, Lorg/apache/tika/metadata/Metadata;->set(Ljava/lang/String;Ljava/lang/String;)V

    goto :goto_1

    .line 39
    :cond_6
    invoke-static {p1}, Lorg/apache/tika/parser/mp3/Mp3Parser$ID3TagsAndAudio;->access$100(Lorg/apache/tika/parser/mp3/Mp3Parser$ID3TagsAndAudio;)Lorg/apache/tika/parser/mp3/AudioFrame;

    move-result-object v0

    invoke-virtual {v0}, Lorg/apache/tika/parser/mp3/AudioFrame;->getChannels()I

    move-result v0

    const/4 v1, 0x5

    if-ne v0, v1, :cond_7

    const-string p1, "5.1"

    .line 40
    invoke-virtual {p2, v2, p1}, Lorg/apache/tika/metadata/Metadata;->set(Ljava/lang/String;Ljava/lang/String;)V

    goto :goto_1

    .line 41
    :cond_7
    invoke-static {p1}, Lorg/apache/tika/parser/mp3/Mp3Parser$ID3TagsAndAudio;->access$100(Lorg/apache/tika/parser/mp3/Mp3Parser$ID3TagsAndAudio;)Lorg/apache/tika/parser/mp3/AudioFrame;

    move-result-object p1

    invoke-virtual {p1}, Lorg/apache/tika/parser/mp3/AudioFrame;->getChannels()I

    move-result p1

    const/4 v0, 0x7

    if-ne p1, v0, :cond_8

    const-string p1, "7.1"

    .line 42
    invoke-virtual {p2, v2, p1}, Lorg/apache/tika/metadata/Metadata;->set(Ljava/lang/String;Ljava/lang/String;)V

    :cond_8
    :goto_1
    return-void
.end method
